<template>
    <div class="video-outer">
        <div class="body-video" :class="getVideoClass(prop.videoMaxNum)" v-for="(value, key, index) in prop.videoHash"
            :key="index" v-show="index < prop.videoMaxNum">
            <video class="my-video" controls :id="key" muted></video>
            <div class="video-title">
            </div>
        </div>
    </div>
</template>
<script setup>
const prop = defineProps({
    videoList: { type: Array },
    videoMaxNum: { type: Number },
    videoHash: { type: Object },//视频dom元素数组
});
function getVideoClass(param) {
    let _hash = {
        1: "oneVideo",
        2: "twoVideo",
        4: "fourVideo",
        6: "sixVideo",
        9: "nineVideo",
        16: "sixteenVideo",
    };
    return _hash[param]
}
</script>
<style lang='scss' scoped>
.video-outer {
    width: 972px;
    height: 540px;
}

.body-video {
    float: left;
    position: relative;
}

.oneVideo {
    width: 100%;
    height: 100%;
}

.twoVideo {
    width: 100%;
    height: 50%;
}

.fourVideo {
    width: 50%;
    height: 50%;
}

.sixVideo {
    width: calc(100% / 3);
    height: calc(100% / 3);

    &:first-of-type {
        width: 66.66%;
        height: 66.66%;
    }

    &:nth-of-type(5) {
        width: 33.3%;
    }

    &:nth-of-type(6) {
        width: 33.35%;
    }
}

.nineVideo {
    // width: calc(100% / 3);
    width: 33.3%;
    height: calc(100% / 3);
}

.sixteenVideo {
    width: 25%;
    height: 25%;
}

.my-video {
    width: 100%;
    height: 100%;
    object-fit: fill;
    background-color: black;
}

.video-title {
    position: absolute;
    // background-color: rgba(0, 0, 0, 0.5);
    color: #fff;
    top: 0;
    left: 0;
    line-height: 24px;
    padding-left: 10px;
    width: 100%;
    box-sizing: border-box;
}
</style>